package week11;

import java.io.*;
import java.net.*;

/**
 * @author The setting sun
 * @version 1.0
 * @title: ClientTest
 * @description: TODO
 * @date 2021/11/17 9:14
 */
public class ClientTest {
    public static void main(String[] args) throws Exception {
        Socket socket = new Socket(InetAddress.getLocalHost(), 7777);

        InputStream is = socket.getInputStream();
        DataInputStream dis = new DataInputStream(is);

        OutputStream os = socket.getOutputStream();
        DataOutputStream dos = new DataOutputStream(os);

        String str1 = dis.readUTF();
        System.out.println(str1);

        dos.writeUTF("乌龟走读");

        String str2 = dis.readUTF();
        System.out.println(str2);

        socket.close();
    }
}
